Passed
Push — master ( 68056d...2f3a19 )
by Dmytro
01:52
created

utils.js ➔ resolve   A

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 3
c 0
b 0
f 0
rs 10
cc 1
1
import path from 'path';
2
import { entry } from './constants';
3
4
export function load(relPath) {
5
    const absPath = path.resolve(entry, relPath);
6
7
    delete require.cache[require.resolve(absPath)];
8
    // eslint-disable-next-line security/detect-non-literal-require
9
    const result =  require(absPath);
10
11
    delete require.cache[require.resolve(absPath)];
12
13
    return result;
14
}
15
16
export function resolve(relPath) {
17
    return require.resolve(path.join(entry, relPath));
18
}
19